#!/usr/bin/python
# -*- coding: utf-8 -*-

"""
#TODO: documentation!
"""

__version__ = '$Id: entity.py 191 2008-02-14 05:43:52Z DLacewell $'

import math
import random

from pyglet import gl


class Entity(object):

    def __init__(self):
        self.x = random.randint(1,600) - 300
        self.y = random.randint(1,400) - 200
        self.dt = random.random() * math.pi
        self.r = random.randint(1,30)

    def draw(self):
        # TODO: draw all entities that are visible to the camera
        self.dt += random.random() * 0.5
        dt = self.dt
        gl.glPushMatrix()
        gl.glTranslatef(self.x + self.r * math.sin(dt), self.y + self.r * math.cos(dt), 1.0)
        gl.glColor3f(1.0, 1.0, 1.0)
        gl.glBegin(gl.GL_POLYGON)
        gl.glColor3f(1.0, 0.0, 0.0)
        gl.glVertex3f(0.0, 0.0, 0.0)
        gl.glColor3f(0.0, 1.0, 0.0)
        gl.glVertex3f(75.0, 25.0, 0.0)
        gl.glColor3f(0.0, 0.0, 1.0)
        gl.glVertex3f(25.0, 75.0, 0.0)
        gl.glEnd()
        gl.glPopMatrix()
        pass
        
